package sziit.znk.services.impl;

import sziit.znk.services.JDBCService;

import java.sql.*;

public class JDBCTools implements JDBCService {

    @Override
    public void release(Connection connection, PreparedStatement preparedStatement) {
        try {
            if (connection != null) {
                connection.close();
            }
            if (preparedStatement != null) {
                preparedStatement.close();
                System.out.println("connection已关闭！");
            }
        } catch (SQLException e) {
            e.printStackTrace();
        }
    }

    @Override
    public void release(Connection connection) {
        try {
            if (connection != null) {
                connection.close();
                System.out.println("connection已关闭！");
            }
        } catch (SQLException e) {
            e.printStackTrace();
        }
    }

}
